package designpatterns.proxy.staticproxy;

import java.util.Map;

public class TableImplProxy implements ITable {
    private ITable tableImpl;

    public TableImplProxy(ITable tableImpl) {
        this.tableImpl = tableImpl;
    }

    @Override
    public void add(Map<String, Object> table) {
        try {
            System.out.println("开启事务:");
            tableImpl.add(table);
            System.out.println("|____提交事务。。。");
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("|____回滚事务。。。");
        } finally {
            System.out.println("|____关闭事务。");
        }
    }
}
